﻿<%@ Page Title="" Language="C#" 
MasterPageFile="~/Account/AuthorAccount/AuthorSite.Master"
AutoEventWireup="true" 
CodeBehind="~/Account/AuthorAccount/PublicationsWaitingForPayment.aspx.cs" 
Inherits="ElectronicJournal.Account.AuthorAccount.PublicationsWaitingForPayment" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Label runat="server" Text="" ID="PublicationIdLabel" />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
        SelectCommand="SELECT Title, Id FROM ScientificDirections ORDER BY Title"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
        SelectCommand="SELECT Title, Id FROM PublicationTypes ORDER BY Title"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server"
        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
        SelectCommand="SELECT * FROM PublicationAuthors WHERE PublicationId = @PublicationId"
        InsertCommand="INSERT INTO PublicationAuthors (Surname, Name, Patronymic, NameEnglish, Email, WorkRussian, WorkEnglish, Capacity, PublicationId, Id) VALUES ('Фамилия', 'Имя', 'Отчество', 'NAME', 'Email', 'Место работы', 'Work Place', 'Должность', @PublicationId, NEWID())"
        UpdateCommand="UPDATE PublicationAuthors SET Surname = @Surname, Name = @Name, Patronymic = @Patronymic, NameEnglish = @NameEnglish, Email = @Email, WorkRussian = @WorkRussian, WorkEnglish = @WorkEnglish, Capacity = @Capacity WHERE Id= @Id"
        DeleteCommand="DELETE FROM PublicationAuthors WHERE Id = @Id">
        <SelectParameters>
            <asp:Parameter Name="PublicationId" Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="PublicationId" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>

    <asp:SqlDataSource ID="SqlDataSource4" runat="server"
        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
        SelectCommand="SELECT * FROM Publications WHERE State = 0 AND AuthorId = @AuthorId">
        <SelectParameters>
            <asp:Parameter Name="AuthorId" Type="String" />
        </SelectParameters>    
    </asp:SqlDataSource>
     
    <asp:GridView runat="server" ID="PublicationGridView" DataSourceID="SqlDataSource4" AutoGenerateColumns="False" DataKeyNames="Id" AutoGenerateSelectButton="true" OnSelectedIndexChanged="ShowPublicationData">
        <Columns>
            <asp:BoundField HeaderText="Название статьи" DataField="TitleRussian" SortExpression="TitleRussian" />
            <asp:BoundField HeaderText="Дата" DataField="Date" SortExpression="Date" />
        </Columns>
    </asp:GridView>
    <asp:Panel runat="server" ID="PublicationDataPanel" Visible="false">
        <table>
            <tbody>
                <tr>
                    <td>
                        <asp:Button runat="server" Text="Оплатить" OnClick="ShowPaymentPanel" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Название публикации на русском языке:
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="TitleRussianTextBox" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Название публикации на английском языке:
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="TitleEnglishTextBox" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Научное направление:
                    </td>
                    <td>
                        <asp:DropDownList ID="ScientificDropDownList" runat="server" DataSourceID="SqlDataSource1" DataTextField="Title" DataValueField="Id" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Тип публикации:
                    </td>
                    <td>
                        <asp:DropDownList ID="TypeDropDownList" runat="server" DataSourceID="SqlDataSource2" DataTextField="Title" DataValueField="Id" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Шифр УДК публикации:
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="UDCIndexTextBox" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Шифр специальности:
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="SpecialityTextBox" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="Button1" Text="Добавить автора" runat="server" OnClick="AddNewAuthor" />
                    </td>
                    <td>
                        <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource3" Width="100%"
                            AutoGenerateColumns="False" DataKeyNames="Id">
                            <Columns>
                                <asp:BoundField DataField="Surname" HeaderText="Surname" 
                                    SortExpression="Surname" />
                                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                                <asp:BoundField DataField="Patronymic" HeaderText="Patronymic" 
                                    SortExpression="Patronymic" />
                                <asp:BoundField DataField="NameEnglish" HeaderText="NameEnglish" 
                                    SortExpression="NameEnglish" />
                                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                                <asp:BoundField DataField="WorkRussian" HeaderText="WorkRussian" 
                                    SortExpression="WorkRussian" />
                                <asp:BoundField DataField="WorkEnglish" HeaderText="WorkEnglish" 
                                    SortExpression="WorkEnglish" />
                                <asp:BoundField DataField="Capacity" HeaderText="Capacity" 
                                    SortExpression="Capacity" />
                                <asp:BoundField DataField="PublicationId" HeaderText="PublicationId" Visible="false"
                                    SortExpression="PublicationId" />
                                <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" Visible="False" 
                                    SortExpression="Id" />
                                <asp:CommandField ShowEditButton="true" EditText="Редактировать" UpdateText="Применить" CancelText="Отмена" />
                                <asp:CommandField ShowDeleteButton="true" DeleteText="Удалить" />
                            </Columns>
                        </asp:GridView>
                    </td>
                </tr>
                <tr>
                    <td>
                        Резюме на русском языке:
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="SummaryRussianTextBox" TextMode="MultiLine" Width="600px" Heidth="100px"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        Резюме на английском языке:
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="SummaryEnglishTextBox" TextMode="MultiLine" Width="600px" Heidth="100px"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        Ключевые слова на русском языке:
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="KeywordsRussianTextBox" TextMode="MultiLine" Width="600px" Heidth="100px"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        Ключевые слова на английском языке:
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="KeywordsEnglishTextBox" TextMode="MultiLine" Width="600px" Heidth="100px"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        Файл статьи:
                    </td>
                    <td>
                        <asp:LinkButton ID="FileArticleLinkButton" runat="server" OnClick="DownloadFileArticle" />
                        <asp:Button Text="Удалить" ID="FileArticleButton" runat="server" OnClick="DeleteFileArticle" />
                        <asp:FileUpload ID="FileArticleUpload" runat="server" Visible="false" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Скан сопроводительного письма:
                    </td>
                    <td>
                        <asp:LinkButton ID="FileLetterLinkButton" runat="server" OnClick="DownloadFileLetter"/>
                        <asp:Button Text="Удалить" ID="FileLetterButton" runat="server" OnClick="DeleteFileLetter"/>
                        <asp:FileUpload ID="FileLetterUpload" runat="server" Visible="false" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Скан экспертного заключения:
                    </td>
                    <td>
                        <asp:LinkButton ID="FileExpertLinkButton" runat="server" OnClick="DownloadFileExpert" />
                        <asp:Button Text="Удалить" ID="FileExpertButton" runat="server" OnClick="DeleteFileExpert"/>
                        <asp:FileUpload ID="FileExpertUpload" runat="server" Visible="false" />
                    </td>
                </tr>
            <tr>
                <td>
                    <asp:Button runat="server" Text="Добавить публикацию" OnClick="AddNewPublication" />
                    <asp:Button runat="server" Text="Отмена" OnClick="ShowPublicationGridView"/>
                    <asp:Label runat="server" ID="ErrorLabel" Text="" ForeColor="Red" />
                </td>
            </tr>
            </tbody>
        </table>
    </asp:Panel>

    <asp:Panel runat="server" ID="PaymentPanel" Visible="false">
        <td>
            <asp:Button runat="server" Text="OK" OnClick="SetStatePaid" />
            <asp:Button runat="server" Text="Отмена" OnClick="ShowPublicationGridView" />
        </td>
    </asp:Panel>
</asp:Content>
